<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #app {
            width: 100vw;
            height: 100vh;
            position: relative;

        }

        .btns {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 350px;
            text-align: center;
        }

        .btns .btn {
            width: 80px;
            height: 40px;
            border: none;
            outline: none;
            margin: 0 20px;
            color: #fff;
        }

        .blue {
            background-color: blue;
        }

        .pink {
            background-color: pink;
        }

        .contents {
            position: fixed;
            left: 0;
            right: 0;
            bottom: -300px;
            width: 100vw;
            height: 230px;
            background-color: #eee;
            color: #fff;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            padding: 20px 0 50px 0;
            transition: all 0.5s;
        }

        .show {
            bottom: 0;
        }

        .item-container {
            display: flex;
        }

        .contents .item {
            width: 100px;
            height: 100px;
            background-color: #333;
            border-radius: 10px;
            text-align: center;
            line-height: 100px;
            margin: 0 10px;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="btns">
            <button class="btn blue" @click="doShow">显示</button>
            <button class="btn pink" @click="doHide">隐藏</button>
        </div>
        <div :class="contentClassArray">
            <div>抽屉</div>
            <div class="item-container">
                <div class="item">文件夹 1</div>
                <div class="item">文件夹 2</div>
                <div class="item">文件夹 3</div>
            </div>
        </div>
    </div>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
        const { ref, reactive, watch, createApp, toRefs } = Vue;
        createApp({
            setup() {
                const state = reactive({
                    contentClassArray: ['contents']
                })
                const doShow = () => {
                    state.contentClassArray.push('show')
                }

                const doHide = () => {
                    state.contentClassArray = state.contentClassArray.filter(item => item !== 'show')

                }
                return {
                    ...toRefs(state),
                    doShow,
                    doHide
                }


            }
        }).mount('#app')
    </script>
</body>

</html>